package generator.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import generator.domain.SysUser;
import generator.service.SysUserService;
import generator.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author 李展鹏
* @description 针对表【t_sys_user(系统用户)】的数据库操作Service实现
* @createDate 2024-04-25 13:57:11
*/
@Service("userService")
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
    implements SysUserService{
    @Resource
    SysUserMapper sysUserMapper;

    /**
     * 登录
     * @param account
     * @return
     */
    @Override
    public SysUser login(String account) {
        return sysUserMapper.queryByAccountAndPwd(account);
    }

    /**
     * 条件查询
     * @param queryRealName
     * @param queryRoleId
     * @return
     */
    @Override
    public int getUserCount(String queryRealName, Integer queryRoleId) {
        return sysUserMapper.getUserCount(queryRealName,queryRoleId);
    }

    /**
     * 分页
     * @param queryRealName
     * @param queryRoleId
     * @param pageIndex
     * @param pageSize
     * @return
     */
    @Override
    public List<SysUser> getUserList(String queryRealName, Integer queryRoleId, Integer pageIndex, Integer pageSize) {
        pageIndex=(pageIndex-1)*pageSize;
        return sysUserMapper.getUserList(queryRealName,queryRoleId,pageIndex,pageSize);
    }

    @Override
    public Boolean add(SysUser sysUser) {
        return sysUserMapper.add(sysUser);
    }

    @Override
    public SysUser getUserById(Integer id) {
        return sysUserMapper.getUserById(id);
    }

    @Override
    public Boolean getUpdateUserId(SysUser sysUser) {
        return sysUserMapper.getUpdateUserId(sysUser);
    }


}




